package com.taiji.dianthus.dao.sys;

import com.taiji.dianthus.domain.sys.SysLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Date;

/**
 * @InterfaceName SysLogRepository
 * @Description 日志
 * @Author H.M
 * @Date 2020/6/22
 */
@Repository
public interface SysLogRepository  extends JpaRepository<SysLog, String>,
        JpaSpecificationExecutor<SysLog> {

    /**
     * 查询日期内登陆信息
     * @param startDate
     * @param endDate
     * @return
     */
    @Query("select count(t) from SysLog t where  t.operation = 1 and " +
            " t.createTime >=:startDate and t.createTime<:endDate and t.enableFlag = 1")
    Integer countByDate(Date startDate, Date endDate);
}
